SUBDIRS := Function1/A Function1/B Function1/C Function1/D Function1/E Function1/F  Function2/A Function2/B Function2/C Function2/D Function2/E Function2/F Function3/A Function3/B Function3/C Function3/D Function3/E Function3/F
P := figure
# 默认目标
all: $(SUBDIRS) run 

# 运行所有测试
run: $(SUBDIRS:=.run) report

report: report.tex
	xelatex report.tex

# 为每个子目录定义构建和运行目标
$(SUBDIRS:=.run):
	@$(MAKE) -C $(patsubst %.run,%,$@) run

clean:  
	rm -f *.fdb_latexmk *.fls *.log *.aux 
	
	for dir in $(SUBDIRS); do \
		$(MAKE) -C $$dir clean; \
	done

	for dir in $(P); do \
		rm -f $$dir/*.png; \
	done


.PHONY: all clean run $(SUBDIRS:=.run)